<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.hcz.web.ValidateServlet"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>在线登录</title>
    <script type="text/javascript" src = "js/jquery.js"></script>
    <style type="text/css">
    	span{
    		color:red;
    	}
    </style>
  </head>
  
  <body>
  <%
  	String code = request.getParameter("code");
  	if("1001".equals(code)){
   %>
   <div>
   	<span>此用户名或密码错误</span>&nbsp;&nbsp;&nbsp;&nbsp;<span><a href = "#">注册用户</a></span>
   </div>
   <%} %>
  <h3>用户登录</h3>
  <form action="login.jspx" method = "post" id = "myform">
  	用户名：<input type = "text" name = "username" id = "user"/><span id = "name_error"></span><br/>
  	密码：<input type = "password" name = "pwd" id = "pwd"/><span id = "pwd_error"></span><br/>
  	<a href = "javascript:;"><img alt="" src="jcaptcha.jpg"> </a>
  	<input type = "text" name = "check"id = "check"/><span id = "check_error"></span><br/>
  	<input type = "button" value = "提交" id = "btn" />
  </form>
  
  <script type="text/javascript">
  	$(document).ready(function(){
	  	$("#user").keydown(function(){
	  		$("#name_error").html("");
	  	});
	  	 $("#pwd").keydown(function(){
	  		$("#pwd_error").html("");
	  	});
	  	$("#check").keydown(function(){
	  		$("#check_error").html("");
	  	});
  		$("#btn").click(function(){
  			var name = $("#user").val();
  			var pwd = $("#pwd").val();
  			var check = $("#check").val();
  			if(name.trim() == ""  ){
  				$("#user").focus();
  				$("#name_error").html("请输入用户名：");
  				return ;
  			}
  			if(pwd == "" ){
  				$("#pwd").focus();
  				$("#pwd_error").html("请输入密码：");
  				return ;
  			}
  			if(check.trim()==null||check.trim()==""){
  				$("#check").focus();
  				$("#check_error").html("请输入验证码：");
  				return ;
  			}
  			$("#myform").submit();
  		});
  	});
  </script>
  </body>
</html>
